package com.biboheart.adapter.support.enums;

import com.biboheart.adapter.support.BaseEnum;

public enum StructureTypeEnum implements BaseEnum<String, String> {
    STRUCTURE_TYPE_PRIMITIVE("primitive", "基础类型"),
    STRUCTURE_TYPE_MAP("map", "单对象"),
    STRUCTURE_TYPE_LIST("list", "列表"),
    ;
    private final String code;
    private final String desc;

    StructureTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String code() {
        return code;
    }

    @Override
    public String desc() {
        return desc;
    }

    public static StructureTypeEnum getStructureType(String code) {
        for (StructureTypeEnum structureTypeEnum : StructureTypeEnum.values()) {
            if (structureTypeEnum.code.equals(code)) return structureTypeEnum;
        }
        return null;
    }
}
